/**
 * @file 	test_mutex005.c
 * @brief 	Test a SYSTEM task preempting a BRR
 * Expected result: 0 because the system task preempts the BRR task
 */
#include "../header/common.h"
#include "../header/os.h"
#include "../header/uart.h"
#include "../header/trace.h"
#include <util/delay.h>
#ifdef test_mutex005

const unsigned char PPP[] = {};
const unsigned int PT = 0;
EVENT* print_event;
//MUTEX* mutex;
int flag = 0;

void system_task(void) {
	Event_Signal(print_event);
}

void generic_task(void)
{
	Task_Create(system_task,1,SYSTEM,1);
	flag = 1;
	Task_Next();
}

int main(void) {
	//use pins 4,5,6 and 7 on Port D for output
	DDRD = (1<<PORTD4) | (1<<PORTD5) | (1<<PORTD6) | (1<<PORTD7);
	UART_BPS bitrate = UART_38400;
	uart_init(bitrate);

    print_event = Event_Init();

    Task_Create(generic_task, 0, BRR, 1);

    Event_Wait(print_event);
    print_single_trace(flag);

    return 0;
}

#endif
